package com.hy.controller;

import com.hy.Result.ResponseResult;
import com.hy.ResultCodeEnum;
import com.hy.common.PageResult;
import com.hy.common.QueryPageBean;
import com.hy.common.Result;
import com.hy.pojo.Doctors;
import com.hy.service.DoctorsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/doctor")
public class DoctorController {
    @Autowired
    private DoctorsService doctorsService;
    @RequestMapping("/getDoctor")
    public PageResult getDoctor(QueryPageBean queryPageBean){
        return doctorsService.getDoctor(queryPageBean);

    }
    @RequestMapping("/addDoctor")
    public Result addDoctor(@RequestBody Doctors doctors){
        return doctorsService.addDoctor(doctors);
    }
    @RequestMapping("/doctorXx/{id}")
    public Result doctorXx(@PathVariable("id") Integer id){
        Doctors doctors=doctorsService.doctorXx(id);
        return new Result(true,"查询成功",doctors);
    }
    @RequestMapping("/getBigdep")
    public Result getBigdep(){
        return doctorsService.getBigdep();
    }
    @RequestMapping("/getHospition")
    public Result getHospition(){
        return doctorsService.getHospition();
    }
    @RequestMapping("/updateDoctors")
    public Result updateDoctors(@RequestBody Doctors doctors){
        return doctorsService.updateDoctors(doctors);
    }
    @RequestMapping("/upload")
    public Result fileUploadService(@RequestParam("file") MultipartFile file) throws Exception {
        String fileUrl=doctorsService.updatefile(file);
        return new Result(true,"上传成功",fileUrl) ;
    }
    /**
     * 查询医生对应的患者信息
     */
    @RequestMapping("/patientBydoctorId/{doctorId}")
    public Result patientBydoctorId(@PathVariable("doctorId") Integer doctorId){
        return doctorsService.patientBydoctorId(doctorId);
    }
    @RequestMapping("/delDoctors/{id}")
    public Result delDoctors(@PathVariable("id") Integer id){
        return doctorsService.delDoctors(id);
    }

    @RequestMapping("/PatienevaluationBydoctorId/{doctorId}")
    public Result PatienevaluationBydoctorId(@PathVariable("doctorId")Integer doctorId){
        return  doctorsService.PatienevaluationBydoctorId(doctorId);
    }
}
